Skip to content

Conversation

Baardrw
Copy link

@Baardrw Baardrw commented Oct 7, 2025

Solved Problem

In the Stick yaw controller the update yaw correction logic is flawed. If unaided yaw is nan it skips the yaw correction by setting the yaw correction to 0. This works if the unaided yaw is always nan or is never nan, but if it becomes nan during execution for some reason this leads to a large jump in yaw set point during yaw lock.

This is because yaw_correction_ is set to 0 and the yaw setpoint output by the controller (if in yaw lock mode) is:

wrap_pi(yaw_setpoint - yaw_correction_prev + _yaw_correction) = wrap_pi(yaw_setpoint - yaw_correction_prev)

if yaw_correction_ is set to 0 and yaw_correction_prev is non zero a large jump in yaw may occour.

Fixes #{Github issue ID}

Solution

  • removes zeroing out of yaw_correction_
    • thereby leaving yaw_correction_prev = yaw_correction_

Changelog Entry

For release notes:

Bugfix: fixed potential yaw instability in MPC flight modes

Baardrw and others added 2 commits October 7, 2025 10:26
if unaided yaw becomes nan during execution the yaw correction would jumpt to 0 causing a large jump in yaw
the change removes this jump by holding the current yaw correction instead
Removed Python extra paths from VS Code settings.
@dakejahl dakejahl requested a review from MaEtUgR October 7, 2025 18:22
Copy link
Contributor

@dakejahl dakejahl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds right, how can we reproduce this to verify?

@dakejahl dakejahl self-assigned this Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants